Skip to content

patch to fix Azure OAuth Code flow when using default (localhost) redirect URL#829

Merged
hadley merged 4 commits intor-lib:mainfrom
pedrobtz:patch-azure-auth-flow
Feb 12, 2026
Merged

patch to fix Azure OAuth Code flow when using default (localhost) redirect URL#829
hadley merged 4 commits intor-lib:mainfrom
pedrobtz:patch-azure-auth-flow

Conversation

@pedrobtz
Copy link
Contributor

@pedrobtz pedrobtz commented Dec 18, 2025

fixes #828

When oauth_flow_auth_code uses the default redirect URI from oauth_redirect_uri() (and it returns "http://localhost/"), the subsequent call to normalize_redirect_uri() adds a random port, creating a mismatch between the authorization and token requests.

possible solution: use redirect$uri in the second request as well.

@pedrobtz
Copy link
Contributor Author

@hadley Could you review this please? At the moment, in https://cran.r-project.org/package=azr, one needs to reimplement the generation of random port to do localhost re-direct for the oauth2 auth flow.

@hadley
Copy link
Member

hadley commented Feb 10, 2026

Ooooh, this explains some weirdness that I've seen too. Can you please also add a news bullet?

@pedrobtz
Copy link
Contributor Author

News bullet added. Many thanks

@hadley hadley merged commit 6867108 into r-lib:main Feb 12, 2026
13 checks passed
@hadley
Copy link
Member

hadley commented Feb 12, 2026

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oauth2 code flow: Azure returns error AADSTS500112

2 participants